<% if remark.new_record? %>
  <%= set_alias("form_redt_#{remark.id}", "form_rnt_#{remark.topic_id}") %>
<% end %>

<%= form_for remark, remote: true, html: {id: "form_redt_#{remark.id}"} do |f| %>

<div class="discussion-bubble" id="div_rsht_<%= remark.id %>">
<%# div_tag "div_ri_", remark %>
  <a href="<%= user_path current_user %>">
    <%= image_tag current_user.avatar, width: 48, height: 48,
      'class' => 'discussion-bubble-avatar' %>
  </a>
  <div class="discussion-bubble-content bubble">
    <div class="discussion-bubble-inner">

      <div class="comment-header" style="margin:0">
        <div class="left comment-header-author">
          <%= user_name current_user %>
        </div>
        <div class="left">
          <ul class="inline-list">
            <%= content_tag :li, js_tag_option('普通评论', {
              "set('remark[remark_type]','')" => "form_redt_#{remark.id}",
              submit: "form_redt_#{remark.id}"
            }, remark.remark_type == '') %>
            <%= content_tag :li, js_tag_option('修改建议', {
              "set('remark[remark_type]','suggestion')" => "form_redt_#{remark.id}",
              submit: "form_redt_#{remark.id}"
            }, remark.remark_type == 'suggestion') if remark.remark_type_allowed? 'suggestion' %>
            <%= content_tag :li, js_tag_option('修改确认', {
              "set('remark[remark_type]','confirm')" => "form_redt_#{remark.id}",
              submit: "form_redt_#{remark.id}"
            }, remark.remark_type == 'confirm') if remark.remark_type_allowed? 'confirm' %>
            <%= content_tag :li, js_tag_option('添加建议', {
              "set('remark[remark_type]','new')" => "form_redt_#{remark.id}",
              submit: "form_redt_#{remark.id}"
            }, remark.remark_type == 'new') if remark.remark_type_allowed? 'new' %>
          </ul>
        </div>
        <div class="clear"></div>
      </div>

      <div class="comment-content">
        <% if !remark.parent_remark_id.nil? %>
          <div class="quote">
            <%= render partial: 'remarks/sub_remark',
                locals: { remark: remark.parent_remark,
                  cancel: remark.new_record? ? remark.topic_id : nil } %>
          </div>
        <% end %>

        <% if remark.question_version.present? || 
            remark.remark_type.can_have_question_version? %>
          <%= render partial: 'question_versions/form',
            locals: { question_version: remark.get_question_version } %>
        <% end %>

        <div id="red_<%= remark.id %>">
          <%= really_submit_tag %>
          <% if remark.new_record? %>
            <%= remark_topic_id_tag(remark) %>
            <%= remark_parent_remark_id_tag(remark) %>
          <% end %>
          <%= f.hidden_field :remark_type %>
          <dl style="margin-bottom:0">
            <dt><%= f.text_area :content %></dt>
            <dt>
              <%= f.submit '提交', 'class' => 'button primary',
                onclick: create_js_true({
                  "set('really_submit','true')" => "form_redt_#{remark.id}"
              }) %>
            </dt>
          </dl>
        </div>

        <% if (!remark.new_record?) && remark.updated_at - remark.created_at > 1.0 %>
          <div class="meta">
            最后修改：<%= remark.updated_at.localtime.to_s(:db) %>
          </div>
        <% end %>
      </div>
    </div>
  </div>
  <div class="clear"></div>
<%#/div%>
</div>

<% end %>
<%# end %>
<%# render partial: 'remarks/form', locals: { remark: remark } %>